'use strict';
// Copyright 2014 Blueant Inc. All Rights Reserved.

/**
 * @fileoverview 远征
 * @author agl
 */

var _ = require('lodash');
var moment = require('moment');
var async = require('async');
var modelUtil = require('../util/modelUtil');
var constantUtil = require('../util/constantUtil');
var Code = require('../consts/code.js');
var mongoConnector = require('../libs/mongodb/mongoConnector');
/* jshint unused:false */
var expeditionSchema = require('../schemas/expeditionSchema');
var Expedition = mongoConnector().model('Expedition');
var PlayerManager = require('../libs/playerManager');

/**
 * 查询远征信息
 */
module.exports.getByRoleId = function (role_id, cb) {
    modelUtil.getByRoleId(Expedition, role_id, function (err, model) {
        if (!!err) {
            console.error(err);
            return cb(err);
        }
        cb(null, model);
    });
};

/**
 * 5点刷新
 */
module.exports.onFiveRefresh = function (self, callback) {
    self.refreshShop();

    if (self.remain_times === 0) {
        self.remain_times = 1;
    }
    self.refresh_shop_times = 0;
    callback();
};
